<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>便民服务平台3.0</title>

</head>

<body>
<jsp:include page="../include/header.jsp"/>
<div class="main-container">
    <div class="mc-hd">
        <p class="query-t">queryCenter</p>
        <h1 class="query-h1">专注高端”互联网+政务”设计</h1>
        <div class="type-wrap">
            <h2 class="typedH2">慧眼看世界，在政务服务的路上不断追求创新！</h2>
        </div>
    </div>
    <div class="mc-bd">

        <div class="container">
            <div class="row">
                <div class="col-sm-3">
                    <div class="mccc-left">
                        <h2>便民查询</h2>
                        <ul class="nav nav-pills nav-stacked" role="tablist">
                            <li class="active"><a href="<c:url value='/taskbases/to_search' />">办理进度查询<i class="caret-right"></i></a></li>

                            <li><a href="<c:url value='/querys/names' />">重名查询<i class="caret-right"></i></a></li>

                        </ul>
                    </div>
                </div>

                <div class="col-sm-9">
                    <div class="mccc-right">
                        <h2>办理进度查询</h2>
                        <form class="form-horizontal" role="form">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">办件序号：</label>
                                <div class="col-sm-7">
                                    <input type="text" id="num" class="form-control" maxlength="40">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">验证码：</label>
                                <div class="col-sm-4">
                                    <input type="text" id="my_code" class="form-control" maxlength="5">
                                </div>
                                <div class="col-sm-2" id="validate_code" >
                                    <a href="javascript:refeshCode()"><img  src="<c:url value='/simpleImg'/>" width="128"  height="34"></a>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-2 col-sm-8">
                                    <button type="button" id="search_task" class="btn btn-blue">查询</button>
                                </div>
                            </div>
                        </form>

                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title">查询结果</h3>
                            </div>
                            <div class="panel-body" id="search_result" style="display:none;">
                                <table class="table table-bordered">
                                    <tr>
                                        <th>办件名称：</th>
                                        <td colspan="3" id="MAT_NAME"></td>
                                    </tr>
                                    <tr>
                                        <th>来办单位：</th>
                                        <td id="UNITATTRIBUTE"></td>
                                        <th>联系人：</th>
                                        <td id="UNITNAME"></td>
                                    </tr>
                                    <tr>
                                        <th>来办时间：</th>
                                        <td id="STARTDODATE"></td>
                                        <th>承诺天数：</th>
                                        <td id="DUEDAYS"></td>
                                    </tr>
                                    <tr>
                                        <th>办件序号：</th>
                                        <td id="TSK_NUM"></td>
                                        <th>办理状态：</th>
                                        <td id="status"></td>
                                    </tr>
                                    <tr>
                                        <th>时间节点：</th>
                                        <td colspan="3">
                                            <div class="planNode clearfix">
                                                <ul>
                                                    <%--class="active"--%>
                                                    <li id="step1"><span>预审</span><i class="glyphicon glyphicon-ok"></i></li>
                                                    <li id="step2"><span>受理</span><i class="glyphicon glyphicon-ok"></i></li>
                                                    <li id="step3"><span>办结</span><i class="glyphicon glyphicon-ok"></i></li>
                                                </ul>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>

    </div>
</div>

<jsp:include page="../include/footer.jsp"/>

<script src="<c:url value='/resource/js/require.js'/>" data-main="<c:url value='/resource/js/main'/>" id="current-page" current-page ="queryCenter"></script>

<%--<script src="<c:url value='/resource/js/jquery-1.9.1.min.js' />" ></script>--%>
<%--<script src="<c:url value='/resource/js/layer/layer.js'/>" ></script>--%>

<script>
    function refeshCode(){
        var a = $("#validate_code");
        var src='<c:url value="/simpleImg?rand="/>'+Math.random();
        a.html("<a href='javascript:refeshCode()'><img src='"+src+"' width='128' height='34'></a>");
    }
    $(function(){


        $("#search_task").click(function(){
            if(!$('#num').val()) {
                layer.tips('办件序号不能为空！', '#num');
                return;
            }
            if(!$('#my_code').val()) {
                layer.tips('验证码不能为空！', '#my_code');
                return;
            }

            $.ajax({
                type: 'POST',
                url: "<c:url value='/taskbases/validatorCode'/>",
                data:{
                    my_code:$("#my_code").val()
                },
                success:function(res){
                    if(res.succ){
                        $.ajax({
                            type: 'GET',
                            url: "<c:url value='/taskbases/num'/>",
                            data: {
                                num:$("#num").val()
                            },
                            success: function (res) {
                                refeshCode();
                                if(res.data){
                                    $("#MAT_NAME").html(res.data.matName);
                                    $("#UNITATTRIBUTE").html(res.data.unitattribute=='B'?"企业":"个人");
                                    $("#UNITNAME").html(res.data.unitname);
                                    $("#STARTDODATE").html(res.data.startdodate);
                                    $("#DUEDAYS").html(res.data.duedays+'工作日');
                                    $("#TSK_NUM").html(res.data.tskNum);
                                    $("#step1").removeClass("active");
                                    $("#step2").removeClass("active");
                                    $("#step3").removeClass("active");
                                    var status_cn="";
                                    if(res.data.projectstatus==0){
                                        status_cn="草稿";
                                    }else if(res.data.projectstatus==1){
                                        status_cn="待预审";
                                    }else if(res.data.projectstatus==2){
                                        status_cn="已预审";
                                        $("#step1").addClass("active");
                                    }else if(res.data.projectstatus==3){
                                        status_cn="审核处理中";
                                        $("#step1").addClass("active");
                                        $("#step2").addClass("active");
                                    }else if(res.data.projectstatus==9){
                                        status_cn="已办结";
                                        $("#step1").addClass("active");
                                        $("#step2").addClass("active");
                                        $("#step3").addClass("active");
                                    }else if(res.data.projectstatus==13){
                                        status_cn="退回申报人";
                                        $("#step1").addClass("active");
                                        $("#step2").addClass("active");
                                        $("#step3").addClass("active");
                                    }else{
                                        status_cn="其它";
                                    }
                                    $("#status").html(status_cn);

//                                    if(res.data.)
//                                    $("#status").html(res.data.);
                                    $("#search_result").show();
                                }else{

                                    layer.open({
                                        content: '未找到办件，请确认办件序号是否正确',
                                        scrollbar: false
                                    });
                                }
                            },
                            error: function (res) {
                                layer.open({
                                    content: res.msg,
                                    scrollbar: false
                                });
                            }
                        });
                    }else{
                        layer.open({
                            content: res.msg,
                            scrollbar: false
                        });
                    }
                },
                error:function(res){
                    toast(res.msg);
                }
            });

        });
    });
</script>
</body>
</html>

